<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cmcc.operator.*"%>
<%@include file="../checkLoginSession.jsp"%>
<%
	String operator_id = request.getParameter("operator_id");
	if (operator_id == null || operator_id.equals("")) {
%>
<script type="text/javascript">	
	history.back();
</script>
<%
	return;
	}

	Operator o = Operator.getOperatorById(operator_id);
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'ListAllOperators.jsp' starting page</title>
<style>
a {
	text-decoration: none
}
</style>
<link href="../style/stylet.css" rel="stylesheet" type="text/css">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
.STYLE3 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>

</head>
<script type="text/javascript">
       
       var flagid=true;
       var flagname = false;
       var falgpwd = false;

	function checkname(obj){
		var name = obj.value;
		var namediv = document.getElementById("name"); 
		if(name.length<4){					
                 namediv.innerHTML = "<font color=red>X</font>姓名不可使用" ;
                 flagname = false;
		}else{
			namediv.innerHTML = "<font color=green>√</font>" ;
			flagname=true;
		}
	}
	
	function checkpwd(){
		var pwd1 = document.getElementById("operator_pwd1").value;
		var pwd2 = document.getElementById("operator_pwd2").value;
		var divpwd2 = document.getElementById("divpwd2");
		var divpwd1 = document.getElementById("divpwd1");
		//alert(pwd1+"-------"+pwd2);
		if(pwd1==pwd2 && pwd1.length>=6){
			//alert("yiyang");
			divpwd1.innerHTML = "<font color=green>√</font>";
			divpwd2.innerHTML = "<font color=green>√</font>";
			flagpwd = true;
		}else if(pwd1.length<6){
			divpwd1.innerHTML = "<font color=red>X</font>至少六位数字";
			divpwd2.innerHTML = "<font color=red>X</font>";
			flagpwd = false;
		}else {
			divpwd1.innerHTML = "<font color=red>X</font>";
			divpwd2.innerHTML = "<font color=red>X</font>两次密码不一致";
			flagpwd = false;
		}
	}
	
	function check(){
		if(flagid&&flagpwd&&flagname){
			return true;
		}
		return false;
	}
</script>
<body link="#73A822" alink="#73A822" vlink="#73A822">
	<font size="2">您现在的位置：>>修改操作员</font>
	
	<br><br>
	<table cellspacing="1" class="table" align="center">
		<tbody>
			<tr class="table_header">
				<td>
					<div align="center" class="STYLE3">编号</div>
				</td>
				<td>
					<div align="center" class="STYLE3">姓名</div>
				</td>
				<td>
					<div align="center" class="STYLE3">密码</div>
				</td>
				<td>
					<div align="center" class="STYLE3">权限</div>
				</td>

			</tr>
			<!-- 请注意:这里我们需要循环显示所有的记录信息 -->

			<tr align="center" class="row2" onMouseOver="this.className='row1'"
				onMouseOut="this.className='row2'">

				<td><%=o.getOperator_id()%></td>
				<td><%=o.getOperator_name()%></td>
				<td><%=o.getOperator_pwd()%></td>
				<td><%=o.getPermission()%></td>
			</tr>
		</tbody>
	</table>
	<br>
	<br>
	<form method="POST" action="saveChange.jsp"
		onsubmit="return check()">
		<input type="hidden" name="flag" value="change">
		<input type="hidden" name="operator_id" value=<%=o.getOperator_id() %>>
		<table cellspacing="1" class="form_table1" align="center">
			<tr>
				<td width="20%">&nbsp;&nbsp;&nbsp;登录ID：</td>
				<td class="formtb_right">
					<table>
						<%=o.getOperator_id()%>
					</table></td>
				<td width="20%"><div id="id">*不可更改</div></td>
			</tr>
			<tr>
				<td width="20%">&nbsp;&nbsp;&nbsp;姓&nbsp; 名：</td>
				<td class="formtb_right"><input type="text"
					name="operator_name" onblur="checkname(this)">
				</td>
				<td width="20%"><div id="name">*不超过20位</div></td>
			</tr>
			<tr>
				<td width="20%">&nbsp;&nbsp;&nbsp;密&nbsp; 码：</td>
				<td class="formtb_right"><input type="password"
					name="operator_pwd1" id="operator_pwd1" onblur="checkpwd()">

				</td>
				<td width="20%"><div id="divpwd1">*至少六位数字</div></td>
			</tr>
			<tr>
				<td width="20%">&nbsp;&nbsp;&nbsp;密码确认：</td>
				<td class="formtb_right"><input type="password"
					name="operator_pwd2" id="operator_pwd2" onblur="checkpwd()">

				</td>
				<td width="20%"><div id="divpwd2">*至少六位数字</div></td>
			</tr>


			<tr>
				<td width="20%">&nbsp;&nbsp;&nbsp;是否管理员：</td>
				<td class="formtb_right"><input type="radio" value="Y"
					name="is_admin"> 是 &nbsp; <input type="radio" value="N"
					name="is_admin" checked="checked"> 否</td>
				<td width="20%"></td>
			</tr>
		</table>
		<br> <br>
		<p align="center">
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit"
				value="提交"> &nbsp;&nbsp;&nbsp; <input type="reset"
				value="全部重写">
		</p>
	</form>
</body>
</html>
